'use strict';

const Controller = require('egg').Controller;

class HomeController extends Controller {
  async index() {
    await this.ctx.render('index');
  }

  async blog() {
    const pageNumber = this.ctx.params.page || 1;
    const data = await this.service.blog.getBlogs(pageNumber);
    await this.ctx.render('blog', {
      'blogs': data.list,
    });
  }
}

module.exports = HomeController;
